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

Query time 0.00026