UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gKiCDbC6GGtStaYjuY2E3MyGg4IADFTJnjMeXNzqKl0=' 
WHERE 
  key_id = '96d984cafbbdcc70f9c2f51df5bc5be40982b0b9c911c41d785ad47c44f221a4' 
  AND (
    token = 'gKiCDbC6GGtStaYjuY2E3MyGg4IADFTJnjMeXNzqKl0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043