UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hktU/rpCdMgb6CScbWsD7oCXO6hDqP03YTecKkR2CE0=' 
WHERE 
  key_id = '2daf96503370498ef43f1a888e75fd684b3d5b88cd5875ab5af6032722807a50' 
  AND (
    token = 'hktU/rpCdMgb6CScbWsD7oCXO6hDqP03YTecKkR2CE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026