UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kdo1Wlf5erdwBNvcaoVXF999jYqad/Y7N9NAdh0Xzco=' 
WHERE 
  key_id = 'd5adee1b425abea0b486fe9cfdddcfaeceba1ca19f0d2f100c0ffbefd6972a78' 
  AND (
    token = 'kdo1Wlf5erdwBNvcaoVXF999jYqad/Y7N9NAdh0Xzco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034