UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5GOIuzUVtfqrEt59ZdfM7YiUcs2OTA/83u0Oe/Gz1Tc='
WHERE
key_id = 'a15c0ee70161e47be8d464e9f014d10f2c937c8a31e4638732d8385f326f8027'
AND (
token = '5GOIuzUVtfqrEt59ZdfM7YiUcs2OTA/83u0Oe/Gz1Tc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)