UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4KEV+oxUISeUBTBtd8gxRPOcY1jmxz4TG8GGnga17L0=' 
WHERE 
  key_id = '523df1d5e19a1784516842871fc319f1df545f97c2b95a4cd3499075dec37e43' 
  AND (
    token = '4KEV+oxUISeUBTBtd8gxRPOcY1jmxz4TG8GGnga17L0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024