UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IuZy8ANr5SZEjPcC2m5DcGAj4LX11/X+SX6q6prYSMw='
WHERE
key_id = '02ed086b929ee3fa0dd0439d00971fb1257267e5fba6f42dda2e5340da06c619'
AND (
token = 'IuZy8ANr5SZEjPcC2m5DcGAj4LX11/X+SX6q6prYSMw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)