UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BxSwSPcSiXpmJCHJNJbypvmbRq9YMKf2Fr77XWI81Bc=' 
WHERE 
  key_id = '226a988bad977dcb8c4a741cf16184af2a7e5cb645675f93e629d117b454be32' 
  AND (
    token = 'BxSwSPcSiXpmJCHJNJbypvmbRq9YMKf2Fr77XWI81Bc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027