UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TkFo56AmOq+DdmRANNmQ6R3mIpBCBOMpEZzBUwfva80='
WHERE
key_id = '947ef0a42a3b878214c8c344152c54093020a5f91e548da450f34d120e980cc3'
AND (
token = 'TkFo56AmOq+DdmRANNmQ6R3mIpBCBOMpEZzBUwfva80='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)