UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MutngQelW2yp5d3bX3R814upXNJVNNV37ODoPur8dQc=' 
WHERE 
  key_id = '2a6914a28df442bba22a73622f4ab63cee16b64d78382bf32753722038d9b738' 
  AND (
    token = 'MutngQelW2yp5d3bX3R814upXNJVNNV37ODoPur8dQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031