UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zwRasDsAmlWY8B6x4KDR5qhjNlYqo43NE1glCLqLIHk=' 
WHERE 
  key_id = '790373534a4951871f561e493d113814c9165f0e108d16b55b508dec806de251' 
  AND (
    token = 'zwRasDsAmlWY8B6x4KDR5qhjNlYqo43NE1glCLqLIHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015