UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NgVwqqRx5sdWjm5+GPCsMfmSijU5vGA49E+6+gqLLbY=' 
WHERE 
  key_id = 'e6cc7bca520d01c680aadbb5608051cbaf3c2f3d95d2af406a880650178e6099' 
  AND (
    token = 'NgVwqqRx5sdWjm5+GPCsMfmSijU5vGA49E+6+gqLLbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036