UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gyIjw1w8ot8RRgS+cG8UiFtbN8QJoW+kAbagSRR4pm0=' 
WHERE 
  key_id = '3a07812e066c02c483e7af2ca992e9176e020b2d9e1fa6e74be537acbd5c215f' 
  AND (
    token = 'gyIjw1w8ot8RRgS+cG8UiFtbN8QJoW+kAbagSRR4pm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040