UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rRfd/WLddb4D+GqSCbbJo2yisbeOcz2nePXmSxR3nDU=' 
WHERE 
  key_id = '7b255ae15413c0878dabe7b667ff2534752de6e296b78d8f6128e0b58bd32949' 
  AND (
    token = 'rRfd/WLddb4D+GqSCbbJo2yisbeOcz2nePXmSxR3nDU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037