UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J5UI7PXmchXre7RSNLVX195tWYQzaZ451JF55yRb61E=' 
WHERE 
  key_id = 'cca98a517e4370ef611ea207326581046a44a8673bbf9610b06f795847ea1032' 
  AND (
    token = 'J5UI7PXmchXre7RSNLVX195tWYQzaZ451JF55yRb61E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033