UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aK+3l1RBatnuCVXhadtzCfKfQBS7uCMdMURdR8lj11U=' 
WHERE 
  key_id = '7d3188dd6d120ee9ff8205a5ca5eaddb7a4c7798dcf606bfc64857f5c8dbebbc' 
  AND (
    token = 'aK+3l1RBatnuCVXhadtzCfKfQBS7uCMdMURdR8lj11U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034