UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IbZ3NDBoI1a4GfPUMbB1kTkXfarnyd6EcVaKuiHOUHg=' 
WHERE 
  key_id = '083518e4cf853f034fcf47f87d62206fdac89d525c6f02929043b33b5947c8d0' 
  AND (
    token = 'IbZ3NDBoI1a4GfPUMbB1kTkXfarnyd6EcVaKuiHOUHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040