UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RXLFbcYsbj8w97HMReuExVS7whGfDpKkQ4odbMNnoyU=' 
WHERE 
  key_id = '5c05e32aca135ac45a9bc1387a99484d1da969de16e3f540a7281ae8b2a3b392' 
  AND (
    token = 'RXLFbcYsbj8w97HMReuExVS7whGfDpKkQ4odbMNnoyU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038