UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QqRlszbV0J0DLs7SvgOqN2TGtiUl0XabhOYS8btaugg='
WHERE
key_id = 'ea0c8c4755cc43c6665da0534181c0c23a1022707a50c91524a24c81c46353c5'
AND (
token = 'QqRlszbV0J0DLs7SvgOqN2TGtiUl0XabhOYS8btaugg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)