UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yd8ZGwXGae83APgPWfLWu9gZXdtNxfbGiBypbrdoYco='
WHERE
key_id = '4cf9e462e14f383988e6cd1db49cb0d9539d6d7082bb8d10805637b33cc58a7c'
AND (
token = 'Yd8ZGwXGae83APgPWfLWu9gZXdtNxfbGiBypbrdoYco='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)