UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gxShAvMDBi/XWaIB87mCiJP5JyOAb1uaq+3Xsi8n95w='
WHERE
key_id = '040a7c828ecc9718a9cfb9a4fbea0a554d39315dd18a71173e6b7e30f4db717a'
AND (
token = 'gxShAvMDBi/XWaIB87mCiJP5JyOAb1uaq+3Xsi8n95w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)