UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dTmmdeZeNioaII/bwdrcw9D1oIY8jxJOSZIrcZm6Ncg='
WHERE
key_id = '5970c549e45cc4e72c347c3838c369a30a99063e4dc71824426a4bdb0c0432de'
AND (
token = 'dTmmdeZeNioaII/bwdrcw9D1oIY8jxJOSZIrcZm6Ncg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)