UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OtewixbFAII2KiwHHberiYeGHd8Bg3i/q4QeVerydvQ=' 
WHERE 
  key_id = 'c90e89bc694e0d846da3bee9afc8d6c59fc6a4a2348ca4413a25dc4d94218c1f' 
  AND (
    token = 'OtewixbFAII2KiwHHberiYeGHd8Bg3i/q4QeVerydvQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044