UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm+5FLutm2guIJ7qN1bQld+PvetGRlymx+jf42PMfrHE=' 
WHERE 
  key_id = '3e7fb5ad6c7cdf5383126da204186606cb0e4ec30916c31d7944cd3177c22b74' 
  AND (
    token = 'm+5FLutm2guIJ7qN1bQld+PvetGRlymx+jf42PMfrHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040