UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vvlFbSMO/GSh5b3C/SrWpFHmZPvhozjhF0+EjxBnq+0=' 
WHERE 
  key_id = '8b4bff4799383a686551a2f456aa37b055205c09371580042f6b476f1ac3e98c' 
  AND (
    token = 'vvlFbSMO/GSh5b3C/SrWpFHmZPvhozjhF0+EjxBnq+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030