UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'As7jL3XIyD6UIq6LILpnUtNuo4LB/1ErQr+ko+Ck4+8=' 
WHERE 
  key_id = 'bd589469612b86f741eec269f7fdf2513c78e9bb935cecd67bbc8f0a0934be47' 
  AND (
    token = 'As7jL3XIyD6UIq6LILpnUtNuo4LB/1ErQr+ko+Ck4+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043