UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8dVOHrON0iLrTYWh080K/KbS7UqLzey1jqMG3q+mPUc=' 
WHERE 
  key_id = 'db3b59cc87339458160af91712e2e4074aef217af60df4eb7bb8352c488d6149' 
  AND (
    token = '8dVOHrON0iLrTYWh080K/KbS7UqLzey1jqMG3q+mPUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031