UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i/eW+n7pzcBwwirM/nMsW6W6XG6kMGUVch6Cpa1tvTw=' 
WHERE 
  key_id = '717c706b0baa0ea81ed3f3f8453ad995d7d84efa2c319413a0f353183ffcc49b' 
  AND (
    token = 'i/eW+n7pzcBwwirM/nMsW6W6XG6kMGUVch6Cpa1tvTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034