UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JSnFDrPeHYLATA9f0DDZKBlqAvAtBSlBPKsXVpg8byc=' 
WHERE 
  key_id = '36fb279b41af8fb506ee0a7da0fd2f2671cfb37e5daa96a141d33aeaebc5883b' 
  AND (
    token = 'JSnFDrPeHYLATA9f0DDZKBlqAvAtBSlBPKsXVpg8byc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038