UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I7f43ci+kNnMQWxMk1FJV7BACZI3NS+FDwL3C38lXMc=' 
WHERE 
  key_id = 'a595c6953993f1b851f90c5e481e8434c1c8849d78a7771eb3ed3ed7cb0c5181' 
  AND (
    token = 'I7f43ci+kNnMQWxMk1FJV7BACZI3NS+FDwL3C38lXMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017