UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NK/piXIMLREVAqch7/pvZr6Xe3IU+UDvK8FvBwIU6NA=' 
WHERE 
  key_id = '57f6ed3bfbe87a360a58d6a7705bd0be256fe65aada98da9498e9ce962be6c2f' 
  AND (
    token = 'NK/piXIMLREVAqch7/pvZr6Xe3IU+UDvK8FvBwIU6NA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027