UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tFATnSiWyZc20XNyV6o7S/GdAS8x+W6EbaP0eV2ym5o='
WHERE
key_id = 'd8516b67379a5136a75a0e9e17b9b235e9d5167ba7127032932dd95ce9e83a6f'
AND (
token = 'tFATnSiWyZc20XNyV6o7S/GdAS8x+W6EbaP0eV2ym5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)