UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M3462Qrb00J4ywZbip9hmezyvguNSugOyFTsryU0WRg=' 
WHERE 
  key_id = '4e65f35c17b6553cbd445359069e03e1591123d4f3647fca1817d7acc3ca5b89' 
  AND (
    token = 'M3462Qrb00J4ywZbip9hmezyvguNSugOyFTsryU0WRg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037