UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HgNx0m/XwKyUPE3d2Jejv1jYFr7EnieBQ8sEL17+Jrc=' 
WHERE 
  key_id = '5fa4d2345aa196437d1783afe9892f95a1d63d701380bdcf3a131f813dba52c5' 
  AND (
    token = 'HgNx0m/XwKyUPE3d2Jejv1jYFr7EnieBQ8sEL17+Jrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045