UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nXqlHIW+Tsmbfk2a0gKIiC6CVdznKhC/8JUCDX1DugA=' 
WHERE 
  key_id = '58bac75ad9d34a6d01fba45e532be73413021f0fbde0f376569ab774df31a491' 
  AND (
    token = 'nXqlHIW+Tsmbfk2a0gKIiC6CVdznKhC/8JUCDX1DugA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028