UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J7h4O8NyB86U0Zw+JaEQwj2EM7CmbRMp2v/or6PZ00E=' 
WHERE 
  key_id = '593ec6bdfeb503d1e96723b1dc7a6f0c518fbca968dc55a200d2f3e38e726681' 
  AND (
    token = 'J7h4O8NyB86U0Zw+JaEQwj2EM7CmbRMp2v/or6PZ00E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026