UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3wHnkY0Vkm4XFClMmqf5iWTNsbbVrbJgh1XB5u8jPAU='
WHERE
key_id = '3d7bcc8cb6547398e1d1bc012c5bde7f08f88908831cb9cec85fa397b3e31d31'
AND (
token = '3wHnkY0Vkm4XFClMmqf5iWTNsbbVrbJgh1XB5u8jPAU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)