UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/b40djvBD9tZ3I2iGipwevjkOvjhkreB7MSWx26+ufU=' 
WHERE 
  key_id = '2414fbbf4cfe62ddc910691d6a5099bb56b8ec4529f62c1a3ff392a8fe16b3d1' 
  AND (
    token = '/b40djvBD9tZ3I2iGipwevjkOvjhkreB7MSWx26+ufU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025