UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1fg1Ci5OFvTBaKcWRhjMyqVSekgVDFF7pLi7Fledkvc='
WHERE
key_id = 'b8f7c11453d0a27068349e19a645dad824755dd416624aa5d07e6c168c89faca'
AND (
token = '1fg1Ci5OFvTBaKcWRhjMyqVSekgVDFF7pLi7Fledkvc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)