UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/5iG95/S8iuMr715VZHKnDJef7ZOJW0L+WfVtmTafF8='
WHERE
key_id = '40f7bf5687ba1feff1dbe8db4a595b3ee6ed6313763a343b4548ccfbcb4803f1'
AND (
token = '/5iG95/S8iuMr715VZHKnDJef7ZOJW0L+WfVtmTafF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)