UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zbg1/xEYRO4AgHga+dHvG46NaC4p29q2rlbSUtwwUbs=' 
WHERE 
  key_id = '5d4afbc72cb56b74cab89b0f5538c4640294fdc30fbd1feb16b180153effc55f' 
  AND (
    token = 'Zbg1/xEYRO4AgHga+dHvG46NaC4p29q2rlbSUtwwUbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028