UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yxI7bKs81gyX3gegxbG6fLdx8E40K0r0say+TTTpY1c='
WHERE
key_id = '3287ef03e17946f61f066ffee27275e0facbb471ace3d05ab914aafc35d572c7'
AND (
token = 'yxI7bKs81gyX3gegxbG6fLdx8E40K0r0say+TTTpY1c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)