UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UBvTh0bpVq5N3dRh7kkgK+NFkDuFcUOwbOmbwp9YaJo=' 
WHERE 
  key_id = '44c040f0d99cbf8f86e377a090db28961306efcc848de92c5bae480a38051b91' 
  AND (
    token = 'UBvTh0bpVq5N3dRh7kkgK+NFkDuFcUOwbOmbwp9YaJo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035