UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G2c8yUP0AIL4tAG/LQTaKqjyteloFvE60vCa5gsBO74=' 
WHERE 
  key_id = 'ff0ccef3bebfb93bb0f607dc5e26cca01e3fa8118671fbf2f3b075c2335eca25' 
  AND (
    token = 'G2c8yUP0AIL4tAG/LQTaKqjyteloFvE60vCa5gsBO74=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032