UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ab7tbq2QV8oVPe0eJU0VBdtV6/kz3yOC2S9NuLGC0q8='
WHERE
key_id = 'df1927d27e91c12b555774a79c5cd223844c8b09b4777af7dc165f4f18a365ed'
AND (
token = 'ab7tbq2QV8oVPe0eJU0VBdtV6/kz3yOC2S9NuLGC0q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)