UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XY/EHBOOfGprlC25nX2qGNz8SIEfAKqbiFebVphS/kw=' 
WHERE 
  key_id = '287e261e00dbde124c613e721664ed0d419dec00f3c62dd107ae8d5b598e680c' 
  AND (
    token = 'XY/EHBOOfGprlC25nX2qGNz8SIEfAKqbiFebVphS/kw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037