UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dc23tH1YQd19Sanb4hSJTSG31TTIgIsDrLXpeETLNcE=' 
WHERE 
  key_id = '70baf853fbcbc178373db7ddbf6de11ff8215bdebac59a3128d6243b854c37bb' 
  AND (
    token = 'Dc23tH1YQd19Sanb4hSJTSG31TTIgIsDrLXpeETLNcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022