UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'exnEw7HUdQ32oY0uwqEW/InuGJ6izebVcDYAc9iY6bQ=' 
WHERE 
  key_id = 'cc289b6d01e23c3c197af4b655aeed013a1109439f43c90c8aaf4dd0c0816892' 
  AND (
    token = 'exnEw7HUdQ32oY0uwqEW/InuGJ6izebVcDYAc9iY6bQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039