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