UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ByAm7GxtLd8d6ZcfCTVAo6QbRZ2TIQTv1+LnOXg9k3A=' 
WHERE 
  key_id = '3052d3b8e36b030dbf74196698cce8c1452c375d710eddd0eba8afb0619c8449' 
  AND (
    token = 'ByAm7GxtLd8d6ZcfCTVAo6QbRZ2TIQTv1+LnOXg9k3A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030