UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a689Y/L/9HvsxdXWcgPsvwcbQmtK5y2oVqgpur9ghkM='
WHERE
key_id = 'cdc1123931df0e407f4938f79ac090acb26471ed56b78a2b0ee4139503aeccfb'
AND (
token = 'a689Y/L/9HvsxdXWcgPsvwcbQmtK5y2oVqgpur9ghkM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)