UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cG5o6Ex3YiHRGtW4XD44hnEmDoWflYaTTYh3zGkn36Q=' 
WHERE 
  key_id = '4b4e3fc7076f8efeda946b0647378e30555ef538d654edf5e636f0c8b39afcfd' 
  AND (
    token = 'cG5o6Ex3YiHRGtW4XD44hnEmDoWflYaTTYh3zGkn36Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041