UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AV9c4Rg/0m1IykBs1YPf1iF9srMHhoQkKSEqD2VXJ/I=' 
WHERE 
  key_id = '4ec6827ff375e1f43e4cd4387e6814eedf6defd1ffcf54f9a247bd8404474263' 
  AND (
    token = 'AV9c4Rg/0m1IykBs1YPf1iF9srMHhoQkKSEqD2VXJ/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043