UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iJ4UT5J/2GUrcfPTiVS2PqHUsDLhiiWCs4XVnfKVnVg=' 
WHERE 
  key_id = '0d9fe81f3c13e82cd1721fa21632aa72adaa6b2c5a69d98464f80390d92edd83' 
  AND (
    token = 'iJ4UT5J/2GUrcfPTiVS2PqHUsDLhiiWCs4XVnfKVnVg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042