UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C4ya5s5k1Nupl7OLubZj2ZLUV0N6J4GBk6T7Fmd49z4=' 
WHERE 
  key_id = '748c51cde93d006a552ce813aa43e08fa874c20969153633292dd661768f7f92' 
  AND (
    token = 'C4ya5s5k1Nupl7OLubZj2ZLUV0N6J4GBk6T7Fmd49z4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023