UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jiv04Ah5GSuG2K2OwmvGNQqbJ8s398DlY+mxnifzuIw=' 
WHERE 
  key_id = 'd0e39d0709af0f1cc539988a6d373ae43dd653db5e2cebb4adf8676fff1a9621' 
  AND (
    token = 'Jiv04Ah5GSuG2K2OwmvGNQqbJ8s398DlY+mxnifzuIw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037