UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jT+EmldFuux3djEqgTVJnbWv7XSTM3WkrRerRYApysw=' 
WHERE 
  key_id = '981ee5c010d6de0514040359cd34df50233d66e93afd3cc5826d3240185f5625' 
  AND (
    token = 'jT+EmldFuux3djEqgTVJnbWv7XSTM3WkrRerRYApysw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024